export const formatDate = (date, type) => {
	date = new Date(date);
	const year = date.getFullYear();
	const month = String(date.getMonth() + 1).padStart(2, "0");
	const day = String(date.getDate()).padStart(2, "0");
	const hours = String(date.getHours()).padStart(2, "0");
	const minutes = String(date.getMinutes()).padStart(2, "0");
	let time = "";
	if (type == 0) {
		time = " 00:00:00";
	} else if (type == 1) {
		time = " " + hours + ":" + minutes + ":00";
	} else if (type == 2) {
		return `${year}-${month}-${day}`;
	} else if (type == 3) {
		return `${year}-${month}`;
	} else if (type == 4) {
		return `${year}年${month}月${day}日`;
	} else if (type == 5) {
		return `${year}年${month}月`;
	}
	return `${year}-${month}-${day}${time}`;
};
export const formatDeadline = (start, end) => {
	if (!start || !end) return "";
	const formatDate = (dateStr) => dateStr.split(" ")[0];
	return `${formatDate(start)} 至 ${formatDate(end)}`;
};
